//
//  KongWHospitalTableViewCell.m
//  LoveOfPet
//
//  Created by dllo on 15/11/20.
//  Copyright © 2015年 孔维. All rights reserved.
//

#import "KongWHospitalTableViewCell.h"

#define kHeight     [UIScreen mainScreen].bounds.size.height / 667
#define kWidth      [UIScreen mainScreen].bounds.size.width / 375
@interface KongWHospitalTableViewCell ()

@property (retain, nonatomic) UIImageView *scoreImg;

@property (retain, nonatomic) UIImageView *distanceImg;
@end
@implementation KongWHospitalTableViewCell
-(void)dealloc
{
    [_img release];
    [_nameLabel release];
    [_scoreLabel release];
    [_distanceLabel release];
    [_addressLabel release];
    [_scoreImg release];
    [_distanceImg release];
    [super dealloc];
}
-(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatSubView];
    }
    return self;
}

-(void)creatSubView
{
    
    self.img = [[UIImageView alloc] init];
    [self.contentView addSubview:self.img];
    [self.img release];
    
    self.nameLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.nameLabel];
    [self.nameLabel release];
    
    self.scoreImg = [[UIImageView alloc] init];
    self.scoreImg.image = [UIImage imageNamed:@"KONGWScoreStar"];
    [self.contentView addSubview:self.scoreImg];
    [self.scoreImg release];
    
    self.scoreLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.scoreLabel];
    [self.scoreLabel release];
    
    self.distanceLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.distanceLabel];
    [self.distanceLabel release];
    
    self.addressLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.addressLabel];
    [self.addressLabel release];
    
    self.distanceImg = [[UIImageView alloc] init];
    self.distanceImg.image = [UIImage imageNamed:@"KongWiconfont-position"];
    [self.contentView addSubview:self.distanceImg];
    [self.distanceImg release];
    
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    self.img.frame = CGRectMake(kWidth * 10, kHeight * 10, 70, 70);
    
    self.nameLabel.frame = CGRectMake(self.img.frame.origin.x + self.img.frame.size.width + 20, self.img.frame.origin.y, kWidth * 200, kHeight * 20);
    
    self.addressLabel.frame = CGRectMake(self.nameLabel.frame.origin.x, self.nameLabel.frame.origin.y + self.nameLabel.frame.size.height + kHeight * 10, kWidth * 260, kWidth * 20);
    
    self.scoreImg.frame = CGRectMake(self.addressLabel.frame.origin.x, self.addressLabel.frame.origin.y + self.addressLabel.frame.size.height + kHeight * 10, kWidth * 20, kHeight * 20);
    
    self.scoreLabel.frame = CGRectMake(self.scoreImg.frame.origin.x + self.scoreImg.frame.size.width + kWidth * 5, self.scoreImg.frame.origin.y, kWidth * 30, self.scoreImg.frame.size.height);
    
    self.distanceImg.frame = CGRectMake(self.scoreLabel.frame.origin.x + self.scoreLabel.frame.size.width + kWidth * 50, self.scoreLabel.frame.origin.y, self.scoreImg.frame.size.width, self.scoreImg.frame.size.height);
    
    self.distanceLabel.frame = CGRectMake(self.distanceImg.frame.origin.x + self.distanceImg.frame.size.width + kWidth * 5, self.distanceImg.frame.origin.y, kWidth * 200, self.distanceImg.frame.size.height);
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
